//
//  RXRTravelNotesVC.swift
//  GoTravel
//
//  Created by lanou3g on 16/3/4.
//  Copyright © 2016年 阮小瑞. All rights reserved.
//

import UIKit

class RXRTravelNotesVC: UIViewController,UITableViewDataSource,UITableViewDelegate,UIScrollViewDelegate {
    //设置第一界面的tableView
    var tableview:UITableView?
    //创建要跳转的图片详情页面
    var DTImageView:TravelDetailedImage?
    //创建要跳转的ScrollView详情页面
    var DTSPView:TravelDetailedScrollerView?
    //数组
    var dataArray:NSMutableArray?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.view.backgroundColor = UIColor.redColor()
        self.navigationItem.title = "游记"
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(named: "HTHome_Menu"), style: UIBarButtonItemStyle.Plain, target: self, action: Selector("showSideView"))
        
        self.tableview = UITableView(frame: CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height))
        self.tableview?.separatorStyle = .None
        self.view.addSubview(tableview!)
        //遵循协议
        self.tableview?.delegate = self
        self.tableview?.dataSource = self
        //注册cell
        self.tableview?.registerClass(TravelDiaryCell.classForCoder(), forCellReuseIdentifier: "CELL")
        
    }
    
    func showSideView()->Void {
        
        self.sideMenuViewController.presentLeftMenuViewController()
        
    }
    
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    
    
    //UITableView协议方法
    
    //设置行数
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
        return 1
        
    }
    
    //创建cell
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
        
        let cell = tableView.dequeueReusableCellWithIdentifier("CELL") as? TravelDiaryCell
        //        cell?.textLabel?.text = "测试"
        cell?.CellOfImageView?.image = UIImage(named: "last1.jpg")
        
        return cell!
    }
    
    //点击页面跳转
    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        
        self.DTImageView = TravelDetailedImage()
        self.DTSPView = TravelDetailedScrollerView()
        
        self.navigationController?.pushViewController(DTSPView!, animated: true)
    }
    
    
    //设置遍数
    func numberOfSectionsInTableView(tableView: UITableView) -> Int // Default is 1 if not implemented
    {
        return 1
    }
    
    
    //设置头标
    func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? // fixed font style. use custom view (UILabel) if you want something different
    {
        return ""
    }
    
    //设置脚标
    func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String?
    {
        return ""
    }
    
    //设置CELL高度
    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return 500
    }
    
    /*
    // MARK: - Navigation
    
    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    // Get the new view controller using segue.destinationViewController.
    // Pass the selected object to the new view controller.
    }
    */
    
}
